﻿using System;
using System.Collections.Generic;
using NHibernate.Criterion;
using Ornament.NHibernates;

namespace Products.Databases.DataAccess
{
    public class FieldDao : DaoBase<Guid, Field>
    {
        protected override Order DefaultOrder
        {
            get { return Order.Asc("Name"); }
        }

        public IList<Field> Find(Table table)
        {
            return CreateDetachedCriteria().Add(Restrictions.Eq("Table", table))
                .GetExecutableCriteria(this.CurrentSession).
                List<Field>();
        }
    }
}
